﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
 
namespace WisDom.Models
{
    /// <summary>
    /// 更新包信息
    /// </summary>
    public class PackageInfoEntity : BaseEntity
    {
        /// <summary>
        /// 更新包信息的编号
        /// </summary>
        public int PackageId { get; set; }

        /// <summary>
        /// 包名称
        /// </summary>
        public string PackageName { get; set; } 

        /// <summary>
        /// 检查包对应的版本号
        /// </summary>
        public string CheckVersionFile { get; set; }

        /// <summary>
        /// 更新的路径相对位置
        /// </summary>
        public string UpdatePath { get; set; }
       
        /// <summary>
        /// 包类型
        /// </summary>
        public string PackageTypeString
        {
            get { return PackageType.ToString(); }
            set
            {
                PackageType = Enum.Parse<PackageType>(value, true);
            }
        }

        /// <summary>
        /// 更新包的类型
        /// </summary>
        [NotMapped]
        public PackageType PackageType { set; get; }
        public override void CalcPrimaryKey()
        {
        }
    }
    /// <summary>
    /// 更新文件类型
    /// </summary>
    public enum PackageType
    {
        /// <summary>
        /// WEB更新包
        /// </summary>
        web = 0, 
        /// <summary>
        /// 更新数据库
        /// </summary>
        database = 1,
        /// <summary>
        /// 更新的可执行文件
        /// </summary>
        exe=2,
 
    }
}
